import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import {
  ROUTE_CONSOLE_DASHBOARD, ROUTE_CONSOLE_PROFILE,
  ROUTE_CONSOLE_STOCKINFO, ROUTE_LOGIN, ROUTE_REGISTER
} from './config'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'Home',
    redirect: ROUTE_CONSOLE_DASHBOARD.use(),
  },
  {
    path: ROUTE_CONSOLE_DASHBOARD.use(),
    name: ROUTE_CONSOLE_DASHBOARD.use(),
    component: () => import(/* webpackChunkName: "dashboard" */ '../views/console/dashboard.vue')
  },
  {
    path: ROUTE_CONSOLE_PROFILE.use(),
    name: ROUTE_CONSOLE_PROFILE.use(),
    component: () => import(/* webpackChunkName: "profile" */ '../views/console/profile.vue')
  },
  {
    path: ROUTE_CONSOLE_STOCKINFO.use(),
    name: ROUTE_CONSOLE_STOCKINFO.use(),
    component: () => import(/* webpackChunkName: "stockInfo" */ '../views/console/stockInfo.vue')
  },
  {
    path: ROUTE_LOGIN.router(),
    name: ROUTE_LOGIN.router(),
    component: () => import(/* webpackChunkName: "login" */ '../views/entry/login.vue')
  },
  {
    path: ROUTE_REGISTER.router(),
    name: ROUTE_REGISTER.router(),
    component: () => import(/* webpackChunkName: "register" */ '../views/entry/register.vue')
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
